package com.landscope.issue.controller.wx.dto;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import lombok.Data;

/**
 * @author qzp
 * @version v1.0
 * @date 2021/8/5 22:34
 **/
@Data
public class AppletReportListDto implements Comparable<AppletReportListDto> {
    private String name;
    private String size;
    private String url;
    private String datetime;

    private int orderBy;

    @Override
    public int compareTo(AppletReportListDto o) {
        DateTime dateTime1 = DateUtil.parseDateTime(o.getDatetime());
        DateTime dateTime2 = DateUtil.parseDateTime(this.datetime);
        if (dateTime1.getTime() > dateTime2.getTime()) {
            return orderBy == 0 ? 1 : -1;
        } else if (dateTime1.getTime() < dateTime2.getTime()) {
            return orderBy == 0 ? -1 : 1;
        }
        return 0;
    }
}
